plot_pandas_GUI()¶You can try this notebook live by lauching it in Binder.This can take a while to launch, be patient.
.
First we import pandas, pandas_GUI plus numpy, and create some data. In this case a noisy sine wave.
import pandas as pd
from pandas_GUI import *
import numpy as np
X = [k*np.pi/10 for k in range(-30,30)]
Y = 98*np.sin(X)+np.random.default_rng().normal(0,3,60)
df = pd.DataFrame({'X':X, 'Y':Y})
This is the plot made using the default settings of plot_pandas_GUI(). See step-by-step example.
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_1 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = df['X'], y = df['Y'],
mode = 'lines', name = 'Noisy Sine',)
Figure_1.add_trace(scat)
Figure_1.update_xaxes(title= 'Time')
Figure_1.update_yaxes(title= 'Amplitude')
Figure_1.update_layout(title = 'Noisy Sine Wave Default Plot', template = 'simple_white')
Figure_1.show()
# Force save widget states so that graph will still be
# available when notebook next opened in trusted state.
JPSLUtils.OTJS('Jupyter.actions.call("widgets:save-with-widgets");')
Figure 1: This should display a live plotly plot that can be zoomed and show point values upon hovering. If you do not see a live plot the notebook is not running or trusted. Click on the 'Not Trusted' button in the Jupyter menu bar to trust the notebook.
Rather than using the default plot options, before adding a trace to the plot you can customize how it will be displayed.
An image of the expanded Y error bars section is shown below.

The choices in the Error Type dropdown are:
none, the default which displays no error bars.percent, which displays error bars that are a fixed percent of the value. The percentage is entered in the % or constant box. Make sure to click outside the box to force setting of the percentage.constant, which displays error bars of a constant size. The constant is entered in the % or constant box. Make sure to click outside the box to force setting of this constant value.data, which displays error bars of a size specified in a column chosen from the same dataframe as the trace. The column is chosen using the Error values dropdown.# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_2 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = df['X'], y = df['Y'],
mode = 'markers', name = 'Noisy Sine',
error_y_type='percent', error_y_value=5.0,)
Figure_2.add_trace(scat)
Figure_2.update_xaxes(title= 'Time', mirror = True)
Figure_2.update_yaxes(title= 'Amplitude', mirror = True)
Figure_2.update_layout(title = 'Example of Percent Error Bars', template = 'simple_white')
Figure_2.show()
# Force save widget states so that graph will still be
# available when notebook next opened in trusted state.
JPSLUtils.OTJS('Jupyter.actions.call("widgets:save-with-widgets");')
Figure 2: Example of percent error bars. In this case they are 5% of $\left |{Amplitude} \right |$.
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_3 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = df['X'], y = df['Y'],
mode = 'markers', name = 'Noisy Sine',
error_y_type='constant', error_y_value=5.0,)
Figure_3.add_trace(scat)
Figure_3.update_xaxes(title= 'Time', mirror = True)
Figure_3.update_yaxes(title= 'Amplitude', mirror = True)
Figure_3.update_layout(title = 'Example of Constant Error Bars', template = 'simple_white')
Figure_3.show()
# Force save widget states so that graph will still be
# available when notebook next opened in trusted state.
JPSLUtils.OTJS('Jupyter.actions.call("widgets:save-with-widgets");')
Figure 3: Examples of the constant error bars ($\pm5$).
We start by adding a column of random numbers with a standard deviation of 10 to our dataframe. Then choose that column as our errors.
df['error']=np.random.default_rng().normal(0,3,60)
# CODE BLOCK generated using plot_pandas_GUI(). See https://github.com/JupyterPhysSciLab/jupyter_Pandas_GUI.
from plotly import graph_objects as go
Figure_4 = go.FigureWidget(layout_template="simple_white")
scat = go.Scatter(x = df['X'], y = df['Y'],
mode = 'markers', name = 'Noisy Sine',
error_y_type='data', error_y_array=df['error'],)
Figure_4.add_trace(scat)
Figure_4.update_xaxes(title= 'Time', mirror = True)
Figure_4.update_yaxes(title= 'Amplitude', mirror = True)
Figure_4.update_layout(title = 'Example of error bars from data', template = 'simple_white')
Figure_4.show()
# Force save widget states so that graph will still be
# available when notebook next opened in trusted state.
JPSLUtils.OTJS('Jupyter.actions.call("widgets:save-with-widgets");')
Figure 4: Example of error bars using the data choice. It may be easier to see the variation if you zoom in on a region.
In addition to trying it below if this is a live notebook, you can look at the other examples listed in the Pandas GUI website.
If you are running this notebook live in binder you can try it here by running the first cell to import the tools and data. Then run the cell below to create the GUI. Note: You may want to expand the collapsed instructions to learn more about each tab.
plot_pandas_GUI()